<template>
	<div class="panel">
		<el-row>
			<el-col :span="5">
				<el-row class="card">
					<el-col class="title">
						<div>
							<span>主诉</span>
						</div>
					</el-col>
					<el-col>
						<div class="content">
							<el-row>
								<el-col :span="24" style="text-align: left;">
								    <el-menu :unique-opened="true" :default-active="openItem">
								          <el-menu-item class="menu-item" @click="getSymptoms(complaint)" :id="'item'+complaint.complaintCode" :index="'item'+complaint.complaintCode" :key="index" v-for="(complaint,index) in complaintList">
								          	<span>
							          			{{complaint.complaintName}}
							          		</span>
								          </el-menu-item>
								    </el-menu>
								</el-col>
							</el-row>
						</div>
					</el-col>
				</el-row>
			</el-col>
			<el-col :span="7">
				<el-row class="card">
					<el-col class="title" :span="10">症状体征</el-col>
					<el-col class="btns" :span="14">
						<el-button-group>
							<el-button size="mini" round @click="openAddSymptom">添加</el-button>
							<el-button size="mini" @click="expandSymptom">展开</el-button>
							<el-button size="mini" @click="diagnosis('close')" round>确定</el-button>
						</el-button-group>
					</el-col>
					<el-col class="mainTitle" v-if="patient.complaintName">
						<el-input placeholder="请输入内容" v-model="patient.complaintName">
						    <template slot="prepend"><span style="font-weight:bolder;">主诉</span></template>
						    <template slot="append">{{patient.diseaseTime}}</template>
						</el-input>
					</el-col>
					<el-col>
						<div class="symptomContent">
							<el-row>
								<el-col>
									<label v-if="patient.temperature" class="smtz">
										T:
										<span>{{patient.temperature}}℃</span>
									</label>
									<label v-if="patient.pulseRate" class="smtz">
										P:
										<span>{{patient.pulseRate}}次/分</span>
									</label>
									<label v-if="patient.breathRate" class="smtz">
										R:
										<span>{{patient.breathRate}}次/分</span>
									</label>
									<label v-if="patient.sbp&&patient.dbp" class="smtz">
										Bp:
										<span>{{patient.sbp}}/{{patient.dbp}}mmHg</span>
										<span v-if="lifeCodes.indexOf('e3')>=0">(Ⅰ期)</span>
										<span v-if="lifeCodes.indexOf('e4')>=0">(Ⅰ期)</span>
										<span v-if="lifeCodes.indexOf('e5')>=0">(Ⅱ期)</span>
									</label>
									
								</el-col>
							</el-row>
							<el-checkbox-group v-model="checkSymptoms">
								<el-row class="symptom">
									<el-col v-show="symptom.isShow" v-for="(symptom,index) in symptomList" :key="index">
										<el-checkbox :label="symptom.symptomCode">
											<span :class="mutexStyle[symptom.isMutex]" :title="symptom.symptomName">
												{{symptom.symptomName}}
											</span>
										</el-checkbox>
									</el-col>
								</el-row>
							</el-checkbox-group>
							<el-row class="symptom">
								<el-col v-for="(symptom,index) in addSymptomList" :key="index">
									<el-checkbox  class="manual" :label="symptom.symptomCode"  checked disabled>
										<span :title="symptom.symptomName">
											{{symptom.symptomName}}
										</span>
									</el-checkbox>
								</el-col>
							</el-row>
						</div>
					</el-col>
				</el-row>
			</el-col>
			<el-col :span="5">
				<el-row class="card">
					<el-col class="title" :span="10">初步诊断</el-col>
					<el-col class="btns" :span="14">
						<el-button-group>
							<el-button size="mini" round @click="openAddDisease">添加</el-button>
							<el-button size="mini" round @click="getDoctorPlan">确定</el-button>
						</el-button-group>
					</el-col>
					<el-col>
						<div class="content">
							<el-checkbox-group v-model="checkDiseases">
								<el-row class="symptom">
									<el-col v-for="(disease,index) in diseaseList" :key="index">
										<el-checkbox v-if="disease.diseaseType!='EA'" class="visit" :label="disease.diseaseCode" v-show="disease.isShow">
											<span :title="disease.diseaseName">
												<p v-for = "(it,inde) in disease.diseaseName.split(';')" :key="'contne_'+inde">{{it}}
												</p>
											</span>
										</el-checkbox>
										<el-checkbox v-if="disease.diseaseType=='EA'" class="visit manual" :label="disease.diseaseCode">
											<span :title="disease.diseaseName">
												<p v-for = "(it,inde) in disease.diseaseName.split(';')" :key="'contne_'+inde">{{it}}
												</p>
											</span>
										</el-checkbox>
									</el-col>
								</el-row>
							</el-checkbox-group>
							<el-row class="symptom">
								<el-col v-for="(disease,index) in addDiseaseList" :key="index">
									<el-checkbox  class="manual" checked disabled>
										<span :title="disease.diseaseName">
											</span>
											{{disease.diseaseName}}
										</span>
									</el-checkbox>
								</el-col>
							</el-row>
						</div>
					</el-col>
				</el-row>
			</el-col>
			<el-col :span="7" v-show="showCard.name=='doctor'">
				<el-row class="card">
					<el-col class="title" :span="11">
						<span>诊疗计划</span>/<span style="color:#aaaaaa;cursor:pointer;" @click="changeCard" title="点击查看护理分诊内容">护理分诊</span>
					</el-col>
					<el-col class="btns" :span="13">
						<el-button-group>
							<el-button size="mini" round @click="consult">自选</el-button>
							<el-button size="mini" @click="consult('fz')">辅助</el-button>
							<el-button size="mini" round @click="showDoctorCase">预览</el-button>
						</el-button-group>
					</el-col>
					<el-col>
						<div class="content">
							<el-row v-if="!editDrugList.length&&!editExamList.length">
								<!-- 紧急处置 -->
								<el-col style="border-bottom:1px solid #eeeeee;">
									<el-popover
											placement="right"
											width="200"
											trigger="click">
											<slot>
												<el-popover
												placement="right"
												width="300"
												trigger="click">
													<el-row>
														<el-col :span="24" style="text-align:center;font-size:12pt;font-weight:bolder;">编辑新处置</el-col>
													</el-row>
													<el-row v-for="(item,key) in edit1List" :key="key">
													<el-col :span="20">【{{key+1}}】{{item.disposalAdvice}}</el-col>
													<el-col :span="4" style="text-align:right;"><el-button type="text" @click="removeTreat(key,'type1')">撤销</el-button></el-col>
													</el-row>
													<el-row>
														<el-col :span="20"><el-input v-model.trim="newTreat" placeholder="请输入要增加的处置内容"></el-input></el-col>
														<el-col :span="4" style="text-align:right;"><el-button type="text" @click="addTreat('type1')">增加</el-button></el-col>
													</el-row>
													<el-button size="mini" round slot="reference">编辑</el-button>
												</el-popover>
												<el-button size="mini" round @click="openExam('type1')">检查</el-button>
												<el-button size="mini" round @click="openDrug('type1')">开药</el-button>
											</slot>
											<span class="disposalCategory" slot="reference"><i class="el-icon-caret-right"></i>紧急处置</span>
									</el-popover>
								</el-col>
								<el-checkbox-group v-model="check1List">
									<el-col  :offset="1" v-for="(item,index) in category1List" :key="'d1'+index">
										<el-checkbox :label="item.disposalContent+'@@@'+item.disposalAdvice">
											<span v-html="item.disposalContent"></span>
										</el-checkbox>
									</el-col>
								</el-checkbox-group>
								<el-col :offset="1" v-for="(item,index) in edit1List" :key="'ed1'+index">
										<el-checkbox :label="item.disposalContent" class="manual" checked disabled>{{item.disposalAdvice}}</el-checkbox>
								</el-col>

								<!-- 一般处置 -->
								<el-col style="border-bottom:1px solid #eeeeee;">
									<el-popover
											placement="right"
											width="200"
											trigger="click">
											<slot>
												<el-popover
												placement="right"
												width="300"
												trigger="click">
													<el-row>
														<el-col :span="24" style="text-align:center;font-size:12pt;font-weight:bolder;">编辑新处置</el-col>
													</el-row>
													<el-row v-for="(item,key) in edit2List" :key="key">
													<el-col :span="20">【{{key+1}}】{{item.disposalAdvice}}</el-col>
													<el-col :span="4" style="text-align:right;"><el-button type="text" @click="removeTreat(key,'type2')">撤销</el-button></el-col>
													</el-row>
													<el-row>
														<el-col :span="20"><el-input v-model.trim="newTreat" placeholder="请输入要增加的处置内容"></el-input></el-col>
														<el-col :span="4" style="text-align:right;"><el-button type="text" @click="addTreat('type2')">增加</el-button></el-col>
													</el-row>
													<el-button size="mini" round slot="reference">编辑</el-button>
												</el-popover>
												<el-button size="mini" round @click="openExam('type2')">检查</el-button>
												<el-button size="mini" round @click="openDrug('type2')">开药</el-button>
											</slot>
											<span class="disposalCategory" slot="reference"><i class="el-icon-caret-right"></i>一般处置</span>
									</el-popover>
								</el-col>
								<el-checkbox-group v-model="check2List">
									<el-col  :offset="1" v-for="(item,index) in category2List" :key="'d2'+index">
										<el-checkbox :label="item.disposalContent+'@@@'+item.disposalAdvice">
											<span v-html="item.disposalContent"></span>
										</el-checkbox>
									</el-col>
								</el-checkbox-group>
								<el-col :offset="1" v-for="(item,index) in edit2List" :key="'ed2'+index">
										<el-checkbox :label="item.disposalContent" class="manual" checked disabled>{{item.disposalAdvice}}</el-checkbox>
								</el-col>

								<!-- 检验、特检 -->
								<el-col style="border-bottom:1px solid #eeeeee;">
									<el-popover
											placement="right"
											width="200"
											trigger="click">
											<slot>
												<el-popover
												placement="right"
												width="300"
												trigger="click">
													<el-row>
														<el-col :span="24" style="text-align:center;font-size:12pt;font-weight:bolder;">编辑新处置</el-col>
													</el-row>
													<el-row v-for="(item,key) in edit3List" :key="key">
													<el-col :span="20">【{{key+1}}】{{item.disposalAdvice}}</el-col>
													<el-col :span="4" style="text-align:right;"><el-button type="text" @click="removeTreat(key,'type3')">撤销</el-button></el-col>
													</el-row>
													<el-row>
														<el-col :span="20"><el-input v-model.trim="newTreat" placeholder="请输入要增加的处置内容"></el-input></el-col>
														<el-col :span="4" style="text-align:right;"><el-button type="text" @click="addTreat('type3')">增加</el-button></el-col>
													</el-row>
													<el-button size="mini" round slot="reference">编辑</el-button>
												</el-popover>
												<el-button size="mini" round @click="openExam('type3')">检查</el-button>
												<el-button size="mini" round @click="openDrug('type3')">开药</el-button>
											</slot>
											<span class="disposalCategory" slot="reference"><i class="el-icon-caret-right"></i>检验、特检</span>
									</el-popover>
								</el-col>
								<el-checkbox-group v-model="check3List">
									<el-col  :offset="1" v-for="(item,index) in category3List" :key="'d3'+index">
										<el-checkbox :label="item.disposalContent+'@@@'+item.disposalAdvice">
											<span v-html="item.disposalContent"></span>
										</el-checkbox>
									</el-col>
								</el-checkbox-group>
								<el-col :offset="1" v-for="(item,index) in edit3List" :key="'ed3'+index">
										<el-checkbox :label="item.disposalContent" class="manual" checked disabled>{{item.disposalAdvice}}</el-checkbox>
								</el-col>

								<!-- 病因治疗 -->
								<el-col style="border-bottom:1px solid #eeeeee;">
									<el-popover
											placement="right"
											width="200"
											trigger="click">
											<slot>
												<el-popover
												placement="right"
												width="300"
												trigger="click">
													<el-row>
														<el-col :span="24" style="text-align:center;font-size:12pt;font-weight:bolder;">编辑新处置</el-col>
													</el-row>
													<el-row v-for="(item,key) in edit4List" :key="key">
													<el-col :span="20">【{{key+1}}】{{item.disposalAdvice}}</el-col>
													<el-col :span="4" style="text-align:right;"><el-button type="text" @click="removeTreat(key,'type4')">撤销</el-button></el-col>
													</el-row>
													<el-row>
														<el-col :span="20"><el-input v-model.trim="newTreat" placeholder="请输入要增加的处置内容"></el-input></el-col>
														<el-col :span="4" style="text-align:right;"><el-button type="text" @click="addTreat('type4')">增加</el-button></el-col>
													</el-row>
													<el-button size="mini" round slot="reference">编辑</el-button>
												</el-popover>
												<el-button size="mini" round @click="openExam('type4')">检查</el-button>
												<el-button size="mini" round @click="openDrug('type4')">开药</el-button>
											</slot>
											<span class="disposalCategory" slot="reference"><i class="el-icon-caret-right"></i>病因治疗</span>
									</el-popover>
								</el-col>
								<el-checkbox-group v-model="check4List">
									<el-col  :offset="1" v-for="(item,index) in category4List" :key="'d4'+index">
										<el-checkbox :label="item.disposalContent+'@@@'+item.disposalAdvice">
											<span v-html="item.disposalContent"></span>
										</el-checkbox>
									</el-col>
								</el-checkbox-group>
								<el-col :offset="1" v-for="(item,index) in edit4List" :key="'ed4'+index">
										<el-checkbox :label="item.disposalContent" class="manual" checked disabled>{{item.disposalAdvice}}</el-checkbox>
								</el-col>

								<!-- 对症治疗 -->
								<el-col style="border-bottom:1px solid #eeeeee;">
									<el-popover
											placement="right"
											width="200"
											trigger="click">
											<slot>
												<el-popover
												placement="right"
												width="300"
												trigger="click">
													<el-row>
														<el-col :span="24" style="text-align:center;font-size:12pt;font-weight:bolder;">编辑新处置</el-col>
													</el-row>
													<el-row v-for="(item,key) in edit5List" :key="key">
													<el-col :span="20">【{{key+1}}】{{item.disposalAdvice}}</el-col>
													<el-col :span="4" style="text-align:right;"><el-button type="text" @click="removeTreat(key,'type5')">撤销</el-button></el-col>
													</el-row>
													<el-row>
														<el-col :span="20"><el-input v-model.trim="newTreat" placeholder="请输入要增加的处置内容"></el-input></el-col>
														<el-col :span="4" style="text-align:right;"><el-button type="text" @click="addTreat('type5')">增加</el-button></el-col>
													</el-row>
													<el-button size="mini" round slot="reference">编辑</el-button>
												</el-popover>
												<el-button size="mini" round @click="openExam('type5')">检查</el-button>
												<el-button size="mini" round @click="openDrug('type5')">开药</el-button>
											</slot>
											<span class="disposalCategory" slot="reference"><i class="el-icon-caret-right"></i>对症治疗</span>
									</el-popover>
								</el-col>
								<el-checkbox-group v-model="check5List">
									<el-col  :offset="1" v-for="(item,index) in category5List" :key="'d5'+index">
										<el-checkbox :label="item.disposalContent+'@@@'+item.disposalAdvice">
											<span v-html="item.disposalContent"></span>
										</el-checkbox>
									</el-col>
								</el-checkbox-group>
								<el-col :offset="1" v-for="(item,index) in edit5List" :key="'ed5'+index">
										<el-checkbox :label="item.disposalContent" class="manual" checked disabled>{{item.disposalAdvice}}</el-checkbox>
								</el-col>

								<!-- 防、治并发症 -->
								<el-col style="border-bottom:1px solid #eeeeee;">
									<el-popover
											placement="right"
											width="200"
											trigger="click">
											<slot>
												<el-popover
												placement="right"
												width="300"
												trigger="click">
													<el-row>
														<el-col :span="24" style="text-align:center;font-size:12pt;font-weight:bolder;">编辑新处置</el-col>
													</el-row>
													<el-row v-for="(item,key) in edit6List" :key="key">
													<el-col :span="20">【{{key+1}}】{{item.disposalAdvice}}</el-col>
													<el-col :span="4" style="text-align:right;"><el-button type="text" @click="removeTreat(key,'type6')">撤销</el-button></el-col>
													</el-row>
													<el-row>
														<el-col :span="20"><el-input v-model.trim="newTreat" placeholder="请输入要增加的处置内容"></el-input></el-col>
														<el-col :span="4" style="text-align:right;"><el-button type="text" @click="addTreat('type6')">增加</el-button></el-col>
													</el-row>
													<el-button size="mini" round slot="reference">编辑</el-button>
												</el-popover>
												<el-button size="mini" round @click="openExam('type6')">检查</el-button>
												<el-button size="mini" round @click="openDrug('type6')">开药</el-button>
											</slot>
											<span class="disposalCategory" slot="reference"><i class="el-icon-caret-right"></i>防、治并发症</span>
									</el-popover>
								</el-col>
								<el-checkbox-group v-model="check6List">
									<el-col  :offset="1" v-for="(item,index) in category6List" :key="'d6'+index">
										<el-checkbox :label="item.disposalContent+'@@@'+item.disposalAdvice">
											<span v-html="item.disposalContent"></span>
										</el-checkbox>
									</el-col>
								</el-checkbox-group>
								<el-col :offset="1" v-for="(item,index) in edit6List" :key="'ed5'+index">
										<el-checkbox :label="item.disposalContent" class="manual" checked disabled>{{item.disposalAdvice}}</el-checkbox>
								</el-col>

								<!-- 中医中药治疗 -->
								<el-col style="border-bottom:1px solid #eeeeee;">
									<el-popover
											placement="right"
											width="200"
											trigger="click">
											<slot>
												<el-popover
												placement="right"
												width="300"
												trigger="click">
													<el-row>
														<el-col :span="24" style="text-align:center;font-size:12pt;font-weight:bolder;">编辑新处置</el-col>
													</el-row>
													<el-row v-for="(item,key) in edit7List" :key="key">
													<el-col :span="20">【{{key+1}}】{{item.disposalAdvice}}</el-col>
													<el-col :span="4" style="text-align:right;"><el-button type="text" @click="removeTreat(key,'type7')">撤销</el-button></el-col>
													</el-row>
													<el-row>
														<el-col :span="20"><el-input v-model.trim="newTreat" placeholder="请输入要增加的处置内容"></el-input></el-col>
														<el-col :span="4" style="text-align:right;"><el-button type="text" @click="addTreat('type7')">增加</el-button></el-col>
													</el-row>
													<el-button size="mini" round slot="reference">编辑</el-button>
												</el-popover>
												<el-button size="mini" round @click="openExam('type7')">检查</el-button>
												<el-button size="mini" round @click="openDrug('type7')">开药</el-button>
											</slot>
											<span class="disposalCategory" slot="reference"><i class="el-icon-caret-right"></i>中医中药治疗</span>
									</el-popover>
								</el-col>
								<el-checkbox-group v-model="check7List">
									<el-col  :offset="1" v-for="(item,index) in category7List" :key="'d7'+index">
										<el-checkbox :label="item.disposalContent+'@@@'+item.disposalAdvice">
											<span v-html="item.disposalContent"></span>
										</el-checkbox>
									</el-col>
								</el-checkbox-group>
								<el-col :offset="1" v-for="(item,index) in edit7List" :key="'ed7'+index">
										<el-checkbox :label="item.disposalContent" class="manual" checked disabled>{{item.disposalAdvice}}</el-checkbox>
								</el-col>

								<!-- 其他 -->
								<el-col style="border-bottom:1px solid #eeeeee;">
									<el-popover
											placement="right"
											width="200"
											trigger="click">
											<slot>
												<el-popover
												placement="right"
												width="300"
												trigger="click">
													<el-row>
														<el-col :span="24" style="text-align:center;font-size:12pt;font-weight:bolder;">编辑新处置</el-col>
													</el-row>
													<el-row v-for="(item,key) in edit8List" :key="key">
													<el-col :span="20">【{{key+1}}】{{item.disposalAdvice}}</el-col>
													<el-col :span="4" style="text-align:right;"><el-button type="text" @click="removeTreat(key,'type8')">撤销</el-button></el-col>
													</el-row>
													<el-row>
														<el-col :span="20"><el-input v-model.trim="newTreat" placeholder="请输入要增加的处置内容"></el-input></el-col>
														<el-col :span="4" style="text-align:right;"><el-button type="text" @click="addTreat('type8')">增加</el-button></el-col>
													</el-row>
													<el-button size="mini" round slot="reference">编辑</el-button>
												</el-popover>
												<el-button size="mini" round @click="openExam('type8')">检查</el-button>
												<el-button size="mini" round @click="openDrug('type8')">开药</el-button>
											</slot>
											<span class="disposalCategory" slot="reference"><i class="el-icon-caret-right"></i>其他</span>
									</el-popover>
								</el-col>
								<el-checkbox-group v-model="check8List">
									<el-col  :offset="1" v-for="(item,index) in category8List" :key="'d8'+index">
										<el-checkbox :label="item.disposalContent+'@@@'+item.disposalAdvice">
											<span v-html="item.disposalContent"></span>
										</el-checkbox>
									</el-col>
								</el-checkbox-group>
								<el-col :offset="1" v-for="(item,index) in edit8List" :key="'ed8'+index">
										<el-checkbox :label="item.disposalContent" class="manual" checked disabled>{{item.disposalAdvice}}</el-checkbox>
								</el-col>							


							</el-row>
							<el-row v-if="editDrugList.length || editExamList.length">
								<!-- 单独开检查 -->
								<el-col style="border-bottom:1px solid #eeeeee;" v-if="editExamList.length">
									<el-popover
											placement="right"
											width="60"
											trigger="click">
											<slot>
												<el-popover
												placement="right"
												width="300"
												trigger="click">
													<el-row>
														<el-col :span="24" style="text-align:center;font-size:12pt;font-weight:bolder;">已开检查</el-col>
													</el-row>
													<el-row v-for="(item,key) in editExamList" :key="key">
													<el-col :span="20">【{{key+1}}】{{item.disposalAdvice}}</el-col>
													<el-col :span="4" style="text-align:right;"><el-button type="text" @click="removeTreat(key,'typeExam')">撤销</el-button></el-col>
													</el-row>
													<el-button size="mini" round slot="reference">编辑</el-button>
												</el-popover>
											</slot>
											<span class="disposalCategory" slot="reference"><i class="el-icon-caret-right"></i>已开检查</span>
									</el-popover>
								</el-col>
								<el-col :offset="1" v-for="(item,index) in editExamList" :key="'edExam'+index">
									<el-checkbox :label="item.disposalContent" class="manual" checked disabled>{{item.disposalAdvice}}</el-checkbox>
								</el-col>

								<!-- 单独取药 -->
								<el-col style="border-bottom:1px solid #eeeeee;" v-if="editDrugList.length">
									<el-popover
											placement="right"
											width="60"
											trigger="click">
											<slot>
												<el-popover
												placement="right"
												width="400"
												trigger="click">
													<el-row>
														<el-col :span="24" style="text-align:center;font-size:12pt;font-weight:bolder;">已开药品</el-col>
													</el-row>
													<el-row v-for="(item,key) in editDrugList" :key="key">
													<el-col :span="20">【{{key+1}}】{{item.disposalAdvice}}</el-col>
													<el-col :span="4" style="text-align:right;"><el-button type="text" @click="removeTreat(key,'typeDrug')">撤销</el-button></el-col>
													</el-row>
													<el-button size="mini" round slot="reference">编辑</el-button>
												</el-popover>
											</slot>
											<span class="disposalCategory" slot="reference"><i class="el-icon-caret-right"></i>已开药品</span>
									</el-popover>
								</el-col>
								<el-col :offset="1" v-for="(item,index) in editDrugList" :key="'edDrug'+index">
									<el-checkbox :label="item.disposalContent" class="manual" checked disabled>{{item.disposalAdvice}}</el-checkbox>
								</el-col>
							</el-row>
						</div>
					</el-col>
				</el-row>
			</el-col>
			<el-col :span="7" v-show="showCard.name=='nurse'">
				<el-row class="card">
					<el-col class="title" :span="11">
						<span style="color:#aaaaaa;cursor:pointer;" @click="changeCard"  title="点击查看诊疗计划内容">诊疗计划</span>/<span>护理分诊</span>
					</el-col>
					<el-col class="btns" :span="13">
						<el-button-group>
							<el-button size="mini" round @click="addNurseTreat">添加</el-button>
							<el-button size="mini" round @click="showNurseCase">预览</el-button>
						</el-button-group>
					</el-col>
					<el-col style="padding-left:15px">
						护理:
					</el-col>
					<el-col>
						<div class="nurseContent">
							<el-checkbox-group v-model="checkNurseDisposal">
								<el-row class="symptom">
									<el-col v-for="(disposal,index) in patient.nurseDisposals" :key="index">
										<el-checkbox :label="disposal.disposalContent">
											<span :title="disposal.disposalContent">
												{{disposal.disposalContent}}
											</span>
										</el-checkbox>
									</el-col>
								</el-row>
							</el-checkbox-group>
							<el-row class="symptom">
								<el-col v-for="(disposal,index) in addNurseDisposals" :key="index">
									<el-checkbox :label="disposal.disposalContent" class="manual" checked disabled>
										<span :title="disposal.disposalContent">
											{{disposal.disposalContent}}
										</span>
									</el-checkbox>
								</el-col>
							</el-row>
						</div>
					</el-col>
					<el-col style="padding-left:15px">
						症状体征:
						<el-autocomplete class="triage" 
							v-model="patient.nurseSymptom"
							:fetch-suggestions="queryNurseDisease"
							@select="confirmNurse"
							style="width:300px;">	
						</el-autocomplete>
					</el-col>
					<el-col style="padding-left:15px">
						护理诊断:
						<el-input class="triage" 
							v-model="patient.nurseDisease"
							style="width:300px;">	
						</el-input>
					</el-col>
				</el-row>
			</el-col>
		</el-row>
		<!-- 修改主诉名称开始 -->
		<el-dialog
			:visible.sync="editComplaintDialog"
			width="500px"
			title="编辑主诉名称">
			<el-row>
				<el-col>
					<el-input v-model="newComplaintName"></el-input>
				</el-col>
			</el-row>
			<span slot="footer" class="dialog-footer">
				<el-button @click="editComplaintDialog = false">取消</el-button>
				<el-button type="primary" @click="confirmEditComplaint">确定</el-button>
			</span>
		</el-dialog>
		<!-- 修改主诉名称结束 -->
		<!-- 添加症状开始 -->
		<el-dialog
			:visible.sync="addSymptomDialog"
			width="550px"
			title="编辑自定义症状">
			<el-row style="line-height:35px;" v-for="(symptom,index) in addSymptomList" :key="index">
				<el-col :span="20" style="text-align:left;">
					【{{index+1}}】{{symptom.symptomName}}
				</el-col>
				<el-col :span="4">
					<el-button size="mini" type="danger" @click="removeAddSymptom(index)">删除</el-button>
				</el-col>
			</el-row>
			<el-row style="margin-top:10px;">
				<el-col :span="20">
					<el-input v-model.trim="addSymptomName"></el-input>
				</el-col>
				<el-col :span="4">
					<el-button @click="confirmAddSymptom" type="primary">添加</el-button>
				</el-col>
			</el-row>
			<span slot="footer" class="dialog-footer">
				<el-button @click="addSymptomDialog = false">关闭</el-button>
			</span>
		</el-dialog>
		<!-- 添加症状结束 -->
		<!-- 添加疾病开始 -->
		<el-dialog
			:visible.sync="addDiseaseDialog"
			width="550px"
			title="编辑自定义疾病">
			<el-row style="line-height:35px;" v-for="(disease,index) in addDiseaseList" :key="index">
				<el-col :span="20" style="text-align:left;">
					【{{index+1}}】{{disease.diseaseName}}
				</el-col>
				<el-col :span="4">
					<el-button size="mini" type="danger" @click="removeAddDisease(index)">删除</el-button>
				</el-col>
			</el-row>
			<el-row style="margin-top:10px;">
				<el-col :span="20">
					<el-input v-model.trim="addDiseaseName"></el-input>
				</el-col>
				<el-col :span="4">
					<el-button @click="confirmAddDisease" type="primary">添加</el-button>
				</el-col>
			</el-row>
			<span slot="footer" class="dialog-footer">
				<el-button @click="addDiseaseDialog = false">关闭</el-button>
			</span>
		</el-dialog>
		<!-- 添加疾病结束 -->
		<!-- 添加护理分诊开始 -->
		<el-dialog
			:visible.sync="addNurseDialog"
			width="550px"
			title="编辑自定义护理内容">
			<el-row style="line-height:35px;" v-for="(disposal,index) in addNurseDisposals" :key="index">
				<el-col :span="20" style="text-align:left;">
					【{{index+1}}】{{disposal.disposalContent}}
				</el-col>
				<el-col :span="4">
					<el-button size="mini" type="danger" @click="removeAddDisposal(index)">删除</el-button>
				</el-col>
			</el-row>
			<el-row style="margin-top:10px;">
				<el-col :span="20">
					<el-input v-model.trim="addDisposalName"></el-input>
				</el-col>
				<el-col :span="4">
					<el-button @click="confirmAddDisposal" type="primary">添加</el-button>
				</el-col>
			</el-row>
			<span slot="footer" class="dialog-footer">
				<el-button @click="addNurseDialog = false">关闭</el-button>
			</span>
		</el-dialog>
		<!-- 添加护理分诊结束 -->
		<!-- 开检查弹窗开始 -->
		<el-dialog
			:visible.sync="examDialog"
			:close-on-click-modal="false"
			width="850px">
			<el-row>
				<el-col style="border:1px solid #cccccc;">
					<el-row>
						<el-col :span="9" style="height:500px;overflow:auto;text-align:left;">
							<el-menu>
						      <el-menu-item :index="'exam_'+index" v-for="(item,index) in examCategoryList" :key="index" @click="getExams(item)">
						        <span :title="item.examCategoryName">{{item.examCategoryName}}</span><span style="color:orange;" v-if="item.examSelected">【{{item.examSelected}}】</span>
						      </el-menu-item>
						    </el-menu> 
						</el-col>
						<el-col :span="15" style="height:500px;overflow:auto;padding-left:10px;text-align:left;line-height:30px;">
							<el-checkbox-group v-model="checkExamList">
							    <el-row>
							    	<el-col v-for="(item,index) in examList" :key="index">
							    		<el-checkbox :label="item.examName" :title="item.examName"></el-checkbox>
							    	</el-col>
							    </el-row>
							 </el-checkbox-group>
						</el-col>
					</el-row>
				</el-col>
			</el-row>
			<span slot="footer" class="dialog-footer">
				<el-button @click="examDialog = false">取消</el-button>
				<el-button type="primary" @click="confirmExam">确定</el-button>
			</span>
		</el-dialog>
	<!-- 开检查弹窗结束 -->
	<!-- 开药弹窗开始 -->
		<el-dialog
			:visible.sync="drugDialog"
			:close-on-click-modal="false"
			width="1200px">
			<el-row>
				<el-col style="border:1px solid #cccccc;">
					<el-row>
						<el-col style="height:500px;overflow:auto;">
							<el-row>
								<el-col>
									<el-table
										:data="addDrugList"		    
									    stripe
										border
									    style="width: 100%">
									    <el-table-column label="药品名称" header-align="center">
									      <template slot-scope="scope">
									        <el-input v-model="scope.row.drugName" class="recipe"></el-input>
									      </template>
									    </el-table-column>
									    <el-table-column
									      label="药品规格" header-align="center" width="180">
									      <template slot-scope="scope">
									      	<el-input v-model="scope.row.drugSpec" class="recipe"></el-input>
									      </template>
									    </el-table-column>
									    <el-table-column label="用法" header-align="center" width="120">
									      <template slot-scope="scope">
									      	<el-select class="recipe" size="mini" v-model="scope.row.usage" placeholder="" clearable>
											    <el-option
											      v-for="uag in usages"
											      :key="uag.value"
											      :label="uag.label"
											      :value="uag.label">
											    </el-option>
											</el-select>
									      </template>
									    </el-table-column>
									    <el-table-column
									      label="用量" header-align="center" width="200">
									      <template slot-scope="scope">
									      	<el-input v-model="scope.row.single" class="recipe"></el-input>
									      </template>
									    </el-table-column>
									    <el-table-column
									      label="频次" header-align="center" width="120">
									      <template slot-scope="scope">
									      	<el-select class="recipe" size="mini" v-model="scope.row.frequency" placeholder="" clearable>
											    <el-option
											      v-for="fqy in frequencys"
											      :key="fqy.value"
											      :label="fqy.label"
											      :value="fqy.label">
											    </el-option>
											</el-select>
									      </template>
									    </el-table-column>
									    <el-table-column
									      label="操作" header-align="center" width="80">
									      <template slot-scope="scope">
									      	<el-button
									          size="mini"
									          type="danger"
									          @click="removeDrug(scope.$index, scope.row)">撤销</el-button>
									      </template>
									    </el-table-column>
									 </el-table>
								</el-col>
								<el-col :span="20" :offset="2" style="margin-top:10px;margin-bottom:20px;">
									<label>药品关键字：</label><el-autocomplete class="searchInput"
									  v-model="keyWords"
									  :fetch-suggestions="querySearchAsync"
									  placeholder="请输入内容"
									  @select="confirmSelect">
									</el-autocomplete>
								</el-col>
							</el-row>
						</el-col>
					</el-row>
				</el-col>
			</el-row>
			<span slot="footer" class="dialog-footer">
				<el-button @click="drugDialog = false">取消</el-button>
				<el-button type="primary" @click="confirmDrug">确定</el-button>
			</span>
		</el-dialog>
	<!-- 开药弹窗结束 -->
	<!-- 诊断病历开始 -->
		<el-dialog
			:visible.sync="doctorCaseDialog"
			:close-on-click-modal="false"
			width="86%">
			<div id="doctorCase">
				<el-row style="font-size:12pt;line-height:45px;text-align:left;padding-left:80px;padding-right:80px;">
					<el-col style="font-size:16pt;text-align:center;"><label>门诊病历</label></el-col>
					<el-col :span="6" style="border-bottom:1px solid #000000;">
						<label>就诊卡号：</label><span>{{patient.cardId}}&nbsp;</span>
					</el-col>
					<el-col :span="18" style="border-bottom:1px solid #000000;text-align:right;">
						<label>&nbsp;过敏史：</label>
						<span v-if="!patient.allergy.length">无药物过敏史</span>
						<span v-if="patient.allergy.length">有{{patient.allergy.join(",")}}药物过敏史</span>
					</el-col>
					<el-col :span="4">
						<label>姓名：</label><span>{{patient.name}}</span>
					</el-col>
					<el-col :span="4">
						<label>性别：</label><span>{{patient.sex}}</span>
					</el-col>
					<el-col :span="4">
						<label>年龄：</label><span>{{patient.age}}</span>
					</el-col>
					<el-col :span="4">
						<label>电话：</label><span>{{patient.telphone}}</span>
					</el-col>
					<el-col :span="8">
						<label>地址：</label><span>{{patient.address}}</span>
					</el-col>
					<el-col :span="4">
						<label>治疗科室：</label><span>{{patient.handlePlace}}</span>
					</el-col>
					<el-col :span="4">
						<label>去向：</label><span>{{patient.department}}</span>
					</el-col>
					<el-col :span="14">
						<label>逗留时长：</label><span>{{patient.stayTime}}</span>
					</el-col>
					<el-col>
						<label>主诉：</label>
						<span v-if="!editDoctorFlag">{{doctorCaseObj.complaint}}</span>
						<el-input v-if="editDoctorFlag" style="width:600px;" v-model="doctorCaseObj.complaint"></el-input>
					</el-col>
					<el-col :span="4">
						<label>神志：</label><span>{{patient.sense}}</span>
					</el-col>
					<el-col :span="4">
						<label>体温：</label><span>{{patient.temperature}}℃</span>
					</el-col>
					<el-col :span="4">
						<label>脉搏：</label><span>{{patient.pulseRate}}次/分</span>
					</el-col>
					<el-col :span="4">
						<label>呼吸：</label><span>{{patient.breathRate}}次/分</span>
					</el-col>
					<el-col :span="4">
						<label>血压：</label><span>{{patient.sbp}}/{{patient.dbp}}mmHg</span>
					</el-col>
					<el-col>
						<label>一般情况：</label><span>{{patient.normal}}</span>
					</el-col>
					<el-col>
						<label>病史体征：</label>
						<p v-if="!editDoctorFlag" class="caseDisposal" v-html="doctorCaseObj.symptom.replace(new RegExp('\r\n','gm'),'<br>').replace(new RegExp('\n','gm'),'<br>')"></p>
						<el-input v-if="editDoctorFlag"
						  type="textarea"
						  :autosize="{ minRows: 3}"
						  placeholder="请输入内容"
						  v-model="doctorCaseObj.symptom">
						</el-input>
					</el-col>
					<el-col>
						<label>初步诊断：</label>
						<p v-if="!editDoctorFlag" class="caseDisposal"
						v-html="doctorCaseObj.diagnosis.replace(new RegExp('\r\n','gm'),'<br>').replace(new RegExp('\n','gm'),'<br>')"></p>
						<el-input v-if="editDoctorFlag"
						  type="textarea"
						  :autosize="{ minRows: 2}"
						  placeholder="请输入内容"
						  v-model="doctorCaseObj.diagnosis">
						</el-input>
					</el-col>
					<!-- <el-col v-if="patient.department=='住家观察'">
						<label>处置：</label>
						<p class="caseDisposal" v-html="patient.doctorDisposalAdvice+'不适随诊'"></p>
					</el-col> -->
					<el-col>
						<label>处置：</label>
						<p v-if="!editDoctorFlag" class="caseDisposal" v-html="doctorCaseObj.disposal.replace(new RegExp('\r\n','gm'),'<br>').replace(new RegExp('\n','gm'),'<br>')"></p>
						<el-input v-if="editDoctorFlag"
						  type="textarea"
						  :autosize="{ minRows: 5}"
						  placeholder="请输入内容"
						  v-model="doctorCaseObj.disposal">
						</el-input>
					</el-col>
					<el-col class="recipeContent" v-for="(item,index) in recipeObj" :key="index">
						<!-- 单个药品时 -->
						<el-row v-if="item.drugs.length==1" v-for="(drug,inde) in item.drugs" :key="inde">
							<el-col>
								{{drug.name}}&emsp;({{drug.spec}})×{{drug.number}}&emsp;
								<span v-show="drug.needTest=='1'">
									（皮试：{{item.skinTest?item.skinTest:"_____"}}）
								</span>
							</el-col>
							<el-col><label>sig:</label>&emsp;{{drug.single}}&emsp;{{item.usage}}&emsp;{{item.frequency}}×{{item.course}}</el-col>
						</el-row>
						<!-- 多个药品时 -->
						<el-row v-if="item.drugs.length>1">
							<el-col>
								<el-row>
									<el-col v-for="(drug,inde) in item.drugs" :key="inde">
										{{drug.name}}&emsp;({{drug.spec}})×{{drug.number}}&emsp;
										<span v-show="drug.needTest=='1'">
											（皮试：{{item.skinTest?item.skinTest:"_____"}}）
										</span>
									</el-col>
								</el-row>
							</el-col>
							<el-col>
								<el-row> 
									<el-col :span="2"><label>sig:</label></el-col>
									<el-col :span="10">
										<el-row>
											<el-col v-for="(drug,inde) in item.drugs" :key="inde">
												{{drug.name}}&nbsp;{{drug.single}}
											</el-col>
										</el-row>
									</el-col>
									<el-col :span="1" class="line">
										<br v-for="(drug,inde) in item.drugs" :key="inde">
									</el-col>
									<el-col :span="7" :offset="1" :style="'line-height:'+item.drugs.length*30+'px'">
										&nbsp;{{item.usage}}&nbsp;{{item.frequency}}×{{item.course}}
									</el-col>
								</el-row>
							</el-col>
						</el-row>
					</el-col>

					<el-col :span="5" :offset="19">
						<label>医生签名：</label>
					</el-col>
					<el-col :span="5" :offset="19">
						<label>日期：</label><span></span>
					</el-col>
				</el-row>
			</div>
			<span slot="footer" class="dialog-footer">
				<el-button v-if="!editDoctorFlag" @click="editDoctorCase">编辑</el-button>
				<el-button v-if="!editDoctorFlag" @click="AgreeAndPrint">确认并打印</el-button>
				<el-button v-if="!editDoctorFlag" @click="doctorCaseDialog = false">关闭</el-button>
				<el-button v-if="editDoctorFlag" @click="confirmEditDoctor">确认编辑</el-button>
				<el-button v-if="editDoctorFlag" @click="generationDoctorCase">重新生成</el-button>
				<el-button v-if="editDoctorFlag" @click="cancleEditDoctorCase">取消编辑</el-button>
			</span>
		</el-dialog>
		<!-- 诊断病历结束 -->
		<!-- 护理病历开始 -->
		<el-dialog
			:visible.sync="nurseCaseDialog"
			width="86%" id="nurseCase"
			title="护理分诊记录">
			<el-row style="font-size:12pt;line-height:35px;text-align:left;padding-left:10px;">
				<el-col :span="6" style="border-bottom:1px solid #000000;">
					<label>就诊卡号：</label><span>{{patient.cardId}}&nbsp;</span>
				</el-col>
				<el-col :span="18" style="border-bottom:1px solid #000000;text-align:right;">
					<label>&nbsp;过敏史：</label>
					<span v-if="!patient.allergy.length">无药物过敏史</span>
					<span v-if="patient.allergy.length">有{{patient.allergy.join(",")}}药物过敏史</span>
				</el-col>
				<el-col :span="4">
					<label>姓名：</label><span>{{patient.name}}</span>
				</el-col>
				<el-col :span="4">
					<label>性别：</label><span>{{patient.sex}}</span>
				</el-col>
				<el-col :span="4">
					<label>年龄：</label><span>{{patient.age}}</span>
				</el-col>
				<el-col :span="4">
					<label>电话：</label><span>{{patient.telphone}}</span>
				</el-col>
				<el-col :span="8">
					<label>地址：</label><span>{{patient.address}}</span>
				</el-col>
				<el-col :span="4">
					<label>分诊时间：</label><span>{{patient.handleTime}}</span>
				</el-col>
				<el-col :span="4">
					<label>治疗科室：</label><span>{{patient.handlePlace}}</span>
				</el-col>
				<el-col :span="4">
					<label>去向：</label><span>{{patient.department}}</span>
				</el-col>
				<el-col :span="11">
					<label>逗留时长：</label><span>{{patient.stayTime}}分钟</span>
				</el-col>
				
				<el-col :span="4">
					<label>神志：</label><span>{{patient.sense}}</span>
				</el-col>
				<el-col :span="4">
					<label>体温：</label><span>{{patient.temperature}}℃</span>
				</el-col>
				<el-col :span="4">
					<label>脉搏：</label><span>{{patient.pulseRate}}次/分</span>
				</el-col>
				<el-col :span="4">
					<label>呼吸：</label><span>{{patient.breathRate}}次/分</span>
				</el-col>
				<el-col :span="4">
					<label>血压：</label><span>{{patient.sbp}}/{{patient.dbp}}mmHg</span>
				</el-col>
				<el-col>
					<label>MEWS评分：</label>
					<span v-if="patient.mews!='-1'">{{patient.mews}}</span>
					<span v-if="patient.mews=='-1'">/</span>
				</el-col>
				<el-col>
					<label>一般情况：</label><span>{{patient.normal}}</span>
				</el-col>
				<el-col>
					<label>症状体征：</label><span>{{patient.nurseSymptom}}</span>
				</el-col>
				<el-col>
					<label>护理诊断：</label><span>{{patient.nurseDisease}}</span>
				</el-col>
				<el-col>
					<label>护理分诊：</label>
					<p class="caseDisposal">
						<span v-html="checkNurseDisposal.join('<br>')"></span><br>
						<span v-for="(item,index) in addNurseDisposals" :key="index">
							{{item.disposalContent}}<br>
						</span>
					</p>
				</el-col>
				<el-col :span="5" :offset="19">
					<label>护士签名：</label>
				</el-col>
				<el-col :span="5" :offset="19">
					<label>日期：</label><span></span>
				</el-col>
			</el-row>
			<span slot="footer" class="dialog-footer">
				<el-button @click="printNurse">打印</el-button>
				<el-button @click="nurseCaseDialog = false">关闭</el-button>
			</span>
		</el-dialog>
		<!-- 护理病历结束 -->
	</div>
</template>
<script type="text/javascript">
	export default{
		name: "Panel",
		data(){
			return {
				editDoctorFlag:false,
				editComplaintDialog:false,
				examDialog:false,
				drugDialog:false,
				examType:'',
				drugType:'',
				newComplaintName:'',
				openItem:"",//用于设置打开的菜单项
				complaintList:[],
				symptomList:[],
				checkSymptoms:[],//存放勾选的症状code
				checkSymptomList:[],//存放勾选的症状对象
				checkDiseases:[],
				diseaseList:[],//得到的初诊疾病
				addDiseaseList:[],//添加的初诊疾病
				addSymptomList:[],
				addSymptomDialog: false,
				addNurseDialog: false,
				addDisposalName:"",//添加护理
				addNurseDisposals:[],
				doctorCaseDialog: false,
				nurseCaseDialog: false,
				addDiseaseDialog:false,
				addDiseaseName:"",
				addSymptomName:"",
				mutexStyle:{
					'0':"",
					'1':"mutexStyle"
				},
				examCategoryList:[],
				examList:[],
				checkExamList:[],
				curCategory:'',
				keyWords:'',
				addDrugList:[],
				checkNurseDisposal:[],
				editExamList:[],
				editDrugList:[],
				category1List:[],
				category2List:[],
				category3List:[],
				category4List:[],
				category5List:[],
				category6List:[],
				category7List:[],
				category8List:[],
				edit1List:[],
				edit2List:[],
				edit3List:[],
				edit4List:[],
				edit5List:[],
				edit6List:[],
				edit7List:[],
				edit8List:[],
				check1List:[],
				check2List:[],
				check3List:[],
				check4List:[],
				check5List:[],
				check6List:[],
				check7List:[],
				check8List:[],
				newTreat:"",
				usages:[{
					label: "口服",
					value: "po"
				},{
					label: "皮内注射",
					value: "id"
				},{
					label: "皮下注射",
					value: "ih"
				},{
					label: "肌内注射",
					value: "im"
				},{
					label: "静脉注射",
					value: "iv"
				},{
					label: "静脉滴注",
					value: "iv.gtt"
				},{
					label: "外用",
					value: "ad.us.ext."
				},{
					label: "内服",
					value: "ad.us.int."
				},{
					label: "吸入",
					value: "inhal"
				},{
					label: "睡前",
					value: "hs"
				},{
					label: "饭前",
					value: "ac"
				},{
					label: "饭后",
					value: "pc"
				},{
					label: "空腹时",
					value: "aj"
				}],
				frequencys:[{
					label: "立即",
					value: "st"
				},{
					label: "必要时",
					value: "prn"
				},{
					label: "每1小时",
					value: "qh"
				},{
					label: "每2小时",
					value: "q2h"
				},{
					label: "每8小时",
					value: "q8h"
				},{
					label: "每日1次",
					value: "Qd"
				},{
					label: "每日2次",
					value: "Bid"
				},{
					label: "每日3次",
					value: "Tid"
				},{
					label: "每日4次",
					value: "Qid"
				},{
					label: "每周1次",
					value: "Qw"
				},{
					label: "每周2次",
					value: "Biw"
				},{
					label: "每晨1次",
					value: "qm"
				},{
					label: "每晚1次",
					value: "qn"
				},{
					label: "隔日1次",
					value: "qod"
				}],
				doctorCaseObj:{
					complaint:'',
					symptom:'',
					disposal:'',
					diagnosis:''
				},
				copyDoctorCaseObj:{

				},
				recipeObj:[]
			}
		},
		computed:{
			light:{
				set(value){
				},
				get(){
					return this.$store.state.light;
				}
			},
			patient:{
				set(value){
				},
				get(){
					return this.$store.state.patient;
				}
			},
			openDialog:{
				set(value){
				},
				get(){
					return this.$store.state.openDialog;
				}
			},
			showCard:{
				set(value){
				},
				get(){
					return this.$store.state.showCard;
				}
			},
			saveFlag:{
				set(value){
				},
				get(){
					return this.$store.state.saveFlag;
				}
			},
			reData:{
				set(value){
				},
				get(){
					return this.$store.state.reData;
				}
			},
			lifeCodes:{
				set(value){
				},
				get(){
					return this.$store.state.lifeCodes;
				}
			},
		},
		mounted:function(){
			var vm = this;
			this.$axios.queryComplaints().then(function(res){
				if (res.data&&res.data.data) {
					vm.complaintList = res.data.data;
				}
			},function(res){
				console.log("error:"+res);
			});
		},
		methods:{
			confirmEditComplaint:function(){
				this.patient.complaintName = this.newComplaintName;
				this.editComplaintDialog = false;
			},
			editComplaintName:function(){
				this.newComplaintName = this.patient.complaintName;
				this.editComplaintDialog = true;
			},
			getSymptoms:function(complaint){
				//提示胸痛中心记录
				if (complaint.complaintCode == '011') {
					this.$notify({
				          title: '操作提示',
				          message: "胸痛患者请注意在【综合】下的【胸痛中心】登记信息",
				          type: 'warning'
				        });
				}
				this.patient.complaintName = complaint.complaintName;
				this.patient.complaintCode = complaint.complaintCode;
				this.symptomList = [];
				this.checkSymptoms=[];
				this.addSymptomList = [];
				this.checkSymptomList=[];
				//清空单独开药开检查内容
				this.editExamList = [];
				this.editDrugList = [];
				var vm = this;
				this.$axios.querySymptoms(complaint.complaintCode).then(function(res){
					var symptomList = [];
					if (res.data&&res.data.data) {
						symptomList = res.data.data;
					}
					symptomList.forEach(function(symptom){
						symptom.isShow = true;
					});
					vm.symptomList = symptomList;

				},function(res){
					console.log("error:"+res);
				});
				if (complaint.complaintCode == "000") {
					this.editComplaintName();
				}
			},
			openAddSymptom:function(){
				this.addSymptomDialog = true;
				this.addSymptomName = "";
			},
			confirmAddSymptom:function(){
				if (this.addSymptomName) {
					var vm = this;
					vm.addSymptomList.push({
						symptomCode:'00',
						symptomName:vm.addSymptomName
					});
				}
				this.addSymptomName = "";
			},
			removeAddSymptom:function(index){
				this.addSymptomList.splice(index,1);
			},
			expandSymptom:function(){
				var vm = this;
				vm.symptomList.forEach(function(symptom){
						symptom.isShow = true;
					});
			},
			closeSymptom:function(){
				var vm =this;
				var checkContent ='-'+ vm.checkSymptoms.join('-') +'-';
				vm.symptomList.forEach(function(symptom){
					if (checkContent.indexOf('-'+symptom.symptomCode+'-')<0) {
						symptom.isShow = false;
					}
				});
			},
			openAddDisease:function(){
				this.addDiseaseDialog = true;
				this.addDiseaseName = "";
			},
			confirmAddDisease:function(){
				var vm =this;
				if (vm.addDiseaseName) {
					vm.addDiseaseList.push({
						diseaseName:vm.addDiseaseName
					});
				}
				vm.addDiseaseName = "";
			},
			removeAddDisease:function(index){
				this.addDiseaseList.splice(index,1);
			},
			diagnosis:function(flag){
				if (flag=='close') {
					this.closeSymptom();
				}
				var vm =this;
				if (!vm.patient.complaintCode) {
					vm.patient.complaintCode = "else";
				}
				vm.$axios.diagnosisDisease(vm.patient.complaintCode,vm.checkSymptoms.join(',')+","+vm.patient.lifeCodes,vm.light.curLight).then(function(res){
						//得到初诊后，1显示，2调整灯示
						var diseaseLight = "1";
						if (res.data&&res.data.data) {
							vm.checkDiseases=[];
							vm.addDiseaseList=[];
							vm.diseaseList=res.data.data;
							//有诊断疾病显示诊疗面板，无诊断且无主诉显示护理
							if (vm.diseaseList.length) {
								vm.showCard.name = "doctor";
							}else if (!vm.patient.complaintName) {
								vm.showCard.name = "nurse";
							}
							vm.diseaseList.forEach(function(disease){
								disease.isShow = false;
								//如果是点击症状确定，则展示全部疾病除N外
								if (flag=='close'&&disease.diseaseType != "N") {
									disease.isShow = true;
								}
								//是回调信息，则展示全部疾病除N外
								if (vm.reData.patient&&vm.reData.patient.recordUUID) {
									var patientDisease = vm.reData.patient.doctorDisease;
									if (disease.diseaseType != "N") {
										disease.isShow = true;
									}
									if (disease.diseaseType == "N") {
										vm.checkDiseases.push(disease.diseaseCode);
									}
									if (patientDisease) {
										var systemDisease = patientDisease.split('@@@')[0];
										if (systemDisease.indexOf(disease.diseaseName+'###')>=0) {
											vm.checkDiseases.push(disease.diseaseCode);
										}
									}

								}else{
									//如果不是点击确定，则只展示EA类型疾病
									if (disease.diseaseType == "EA") {
										disease.isShow = true;
									}
									if (disease.diseaseType == "N" || disease.diseaseType == "EA") {
										vm.checkDiseases.push(disease.diseaseCode);
									}
								}
								//设置疾病灯示
								if (disease.diseaseLight) {
									diseaseLight = diseaseLight +disease.diseaseLight;
								}
							});
							//是回调信息，则需要处理自定义的疾病
							if (vm.reData.patient&&vm.reData.patient.recordUUID) {
								var patientDisease = vm.reData.patient.doctorDisease;
								if (patientDisease) {
									var customDisease = patientDisease.split('@@@')[1];
									customDisease.split("###").forEach(function(customDiseaseName){
										if (customDiseaseName) {
											vm.addDiseaseList.push({
												diseaseName:customDiseaseName
											});
										}
									});
								}

							}
							vm.getDoctorPlan();
						}
						vm.light.diseaseLight = diseaseLight;
					},function(res){
						console.log("error:"+res);
					});	
			},
			setMutexStyle:function(symptomCode,isMutex){
				this.symptomList.forEach(function(symptom){
					if (symptom.symptomCode == symptomCode) {
						symptom.isMutex = isMutex;
					}
				});
			},
			openExam:function(type){
				this.examType = type;
				this.examCategoryList = [];
				this.examList = [];
				this.checkExamList = [];
				var vm = this;
				vm.$axios.getAllExamCategory().then(function(res){
					if (res.data&&res.data.data) {
						var categoryList = res.data.data;
						categoryList.forEach(function(category){
							category.examSelected = 0;
						});
						vm.examCategoryList = categoryList;
						vm.examDialog = true;
					}
				},function(res){
					console.log("error:"+res);
				});
			},
			getExams:function(examCategory){
				this.examList = [];
				this.curCategory = examCategory;
				var vm = this;
				vm.$axios.getExamByCategory(examCategory.examCategoryName).then(function(res){
					if (res.data&&res.data.data) {
						vm.examList = res.data.data;
					}
				},function(res){
					console.log("error:"+res);
				});
			},
			confirmExam:function(){
				var vm = this;
				if (vm.examType == 'type1') {
					vm.checkExamList.forEach(function(exam){
						vm.edit1List.push({
							disposalContent:'@1@'+exam,
							disposalAdvice:exam
						});
					});
				}else if (vm.examType == 'type2') {
					vm.checkExamList.forEach(function(exam){
						vm.edit2List.push({
							disposalContent:'@2@'+exam,
							disposalAdvice:exam
						});
					});
				}else if (vm.examType == 'type3') {
					vm.checkExamList.forEach(function(exam){
						vm.edit3List.push({
							disposalContent:'@3@'+exam,
							disposalAdvice:exam
						});
					});
				}else if (vm.examType == 'type4') {
					vm.checkExamList.forEach(function(exam){
						vm.edit4List.push({
							disposalContent:'@4@'+exam,
							disposalAdvice:exam
						});
					});
				}else if (vm.examType == 'type5') {
					vm.checkExamList.forEach(function(exam){
						vm.edit5List.push({
							disposalContent:'@5@'+exam,
							disposalAdvice:exam
						});
					});
				}else if (vm.examType == 'type6') {
					vm.checkExamList.forEach(function(exam){
						vm.edit6List.push({
							disposalContent:'@6@'+exam,
							disposalAdvice:exam
						});
					});
				}else if (vm.examType == 'type7') {
					vm.checkExamList.forEach(function(exam){
						vm.edit7List.push({
							disposalContent:'@7@'+exam,
							disposalAdvice:exam
						});
					});
				}else if (vm.examType == 'type8') {
					vm.checkExamList.forEach(function(exam){
						vm.edit8List.push({
							disposalContent:'@8@'+exam,
							disposalAdvice:exam
						});
					});
				}else if (vm.examType == "typeExam") {
						vm.checkExamList.forEach(function(exam){
							vm.editExamList.push({
								disposalContent:'@exam@'+exam,
								disposalAdvice:exam
							});
						});	
					}
				vm.showCard.name = "doctor";
				vm.examDialog = false;
			},
			openDrug:function(type){
				this.drugType = type;
				this.addDrugList = [];
				this.drugDialog = true;
			},
			removeTreat:function(index,type){
				if (type=='typeExam') {
					this.editExamList.splice(index,1);
				}else if (type=='typeDrug') {
					this.editDrugList.splice(index,1);
				}
			},
			confirmSelect:function(item){
				this.addDrugList.push({
					drugName: item.drugName,
					drugSpec: item.drugSpec,
					usage: '',
					single: '',
					frequency: ''
				});
				this.keyWords="";
			},
			querySearchAsync:function(queryString, cb){
				if (!queryString) {
					return false;
				}
				var vm =this;
				vm.$axios.getDrugs(queryString).then(function(res){
					var result = res.data.data;
					result.forEach(function(drug){
						drug.value = drug.drugName+"---"+drug.drugSpec;
					});
					cb(result);
				},function(res){
					console.log("error:"+res);
				});
			},
			removeDrug:function(index,drug){
				console.log(drug)
				this.addDrugList.splice(index,1);
			},
			confirmDrug:function(){
				var vm =this;
				if (vm.drugType == 'type1') {
					vm.addDrugList.forEach(function(drug){
						vm.edit1List.push({
							disposalContent:'@1@'+drug.drugName+' '+drug.single+' '+drug.usage+' '+drug.frequency,
							disposalAdvice:drug.drugName+' '+drug.single+' '+drug.usage+' '+drug.frequency
						});
					});
				}else if (vm.drugType == 'type2') {
					vm.addDrugList.forEach(function(drug){
						vm.edit2List.push({
							disposalContent:'@2@'+drug.drugName+' '+drug.single+' '+drug.usage+' '+drug.frequency,
							disposalAdvice:drug.drugName+' '+drug.single+' '+drug.usage+' '+drug.frequency
						});
					});
				}else if (vm.drugType == 'type3') {
					vm.addDrugList.forEach(function(drug){
						vm.edit3List.push({
							disposalContent:'@3@'+drug.drugName+' '+drug.single+' '+drug.usage+' '+drug.frequency,
							disposalAdvice:drug.drugName+' '+drug.single+' '+drug.usage+' '+drug.frequency
						});
					});
				}else if (vm.drugType == 'type4') {
					vm.addDrugList.forEach(function(drug){
						vm.edit4List.push({
							disposalContent:'@4@'+drug.drugName+' '+drug.single+' '+drug.usage+' '+drug.frequency,
							disposalAdvice:drug.drugName+' '+drug.single+' '+drug.usage+' '+drug.frequency
						});
					});
				}else if (vm.drugType == 'type5') {
					vm.addDrugList.forEach(function(drug){
						vm.edit5List.push({
							disposalContent:'@5@'+drug.drugName+' '+drug.single+' '+drug.usage+' '+drug.frequency,
							disposalAdvice:drug.drugName+' '+drug.single+' '+drug.usage+' '+drug.frequency
						});
					});
				}else if (vm.drugType == 'type6') {
					vm.addDrugList.forEach(function(drug){
						vm.edit6List.push({
							disposalContent:'@6@'+drug.drugName+' '+drug.single+' '+drug.usage+' '+drug.frequency,
							disposalAdvice:drug.drugName+' '+drug.single+' '+drug.usage+' '+drug.frequency
						});
					});
				}else if (vm.drugType == 'type7') {
					vm.addDrugList.forEach(function(drug){
						vm.edit7List.push({
							disposalContent:'@7@'+drug.drugName+' '+drug.single+' '+drug.usage+' '+drug.frequency,
							disposalAdvice:drug.drugName+' '+drug.single+' '+drug.usage+' '+drug.frequency
						});
					});
				}else if (vm.drugType == 'type8') {
					vm.addDrugList.forEach(function(drug){
						vm.edit8List.push({
							disposalContent:'@8@'+drug.drugName+' '+drug.single+' '+drug.usage+' '+drug.frequency,
							disposalAdvice:drug.drugName+' '+drug.single+' '+drug.usage+' '+drug.frequency
						});
					});
				}else if (vm.drugType == 'typeDrug') {
					vm.addDrugList.forEach(function(drug){
						vm.editDrugList.push({
							disposalContent:'@drug@'+drug.drugName+' '+drug.single+' '+drug.usage+' '+drug.frequency,
							disposalAdvice:drug.drugName+' '+drug.single+' '+drug.usage+' '+drug.frequency
						});
					});	
				}
				vm.showCard.name = "doctor";
				vm.drugDialog = false;
			},
			changeCard:function(){
				if (this.showCard.name == "nurse") {
					this.showCard.name = "doctor";
				}else{
					this.showCard.name = "nurse";
				}
			},
			getDoctorPlan:function(){
				//this.showCard.name = "doctor";
				var vm =this;
				//在处理处置时增加带主诉的症状和生命体征，实现根据症状过滤或替换处置
				let allSymptoms = "";
				vm.checkSymptoms.forEach(function(item){
					allSymptoms = allSymptoms+vm.patient.complaintCode+'-'+item+',';
				});
				allSymptoms =allSymptoms + vm.patient.lifeCodes;
				vm.$axios.getDoctorDisposal(vm.checkDiseases.join(","),vm.patient.tDiseaseCode,vm.light.curLight,allSymptoms).then(function(res){
					if (res.data&&res.data.data) {
						//此处是获取的全部处置
						if (res.data.data.length>0) {
							vm.editDrugList = [];
							vm.editExamList = [];
						}
						//清空原有处置
						vm.category1List = [];
						vm.category2List = [];
						vm.category3List = [];
						vm.category4List = [];
						vm.category5List = [];
						vm.category6List = [];
						vm.category7List = [];
						vm.category8List = [];
						vm.check1List = [];
						vm.check2List = [];
						vm.check3List = [];
						vm.check4List = [];
						vm.check5List = [];
						vm.check6List = [];
						vm.check7List = [];
						vm.check8List = [];
						vm.edit1List = [];
						vm.edit2List = [];
						vm.edit3List = [];
						vm.edit4List = [];
						vm.edit5List = [];
						vm.edit6List = [];
						vm.edit7List = [];
						vm.edit8List = [];
						var level = 0;
						res.data.data.forEach(function(disposal){
							if (disposal.disposalType == "1") {
								level = level + 1;
							}
							if (level == 1 && disposal.disposalType!="1") {
								vm.category1List.push(disposal);
							}
							if (level == 2 && disposal.disposalType!="1") {
								vm.category2List.push(disposal);
							}
							if (level == 3 && disposal.disposalType!="1") {
								vm.category3List.push(disposal);
							}
							if (level == 4 && disposal.disposalType!="1") {
								vm.category4List.push(disposal);
							}
							if (level == 5 && disposal.disposalType!="1") {
								vm.category5List.push(disposal);
							}
							if (level == 6 && disposal.disposalType!="1") {
								vm.category6List.push(disposal);
							}
							if (level == 7 && disposal.disposalType!="1") {
								vm.category7List.push(disposal);
							}
							if (level == 8 && disposal.disposalType!="1") {
								vm.category8List.push(disposal);
							}

						});
						if (!vm.reData.patient.recordUUID) {
							vm.consult();
						}
						//如果存在回调就绑定选择
						if (vm.reData.patient&&vm.reData.patient.recordUUID){
							var disposalStr = vm.reData.patient.doctorDisposal;
							var nurseDisposalStr = vm.reData.patient.nurseDisposal.split("@@@")[0]+"###";
							var addNurseDisposalStr = vm.reData.patient.nurseDisposal.split("@@@")[1];
							if (disposalStr) {
								res.data.data.forEach(function(disposal){
									if (disposalStr.indexOf('*1*'+disposal.disposalContent)>=0) {
										vm.check1List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
									}else if (disposalStr.indexOf('*2*'+disposal.disposalContent)>=0) {
										vm.check2List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
									}else if (disposalStr.indexOf('*3*'+disposal.disposalContent)>=0) {
										vm.check3List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
									}else if (disposalStr.indexOf('*4*'+disposal.disposalContent)>=0) {
										vm.check4List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
									}else if (disposalStr.indexOf('*5*'+disposal.disposalContent)>=0) {
										vm.check5List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
									}else if (disposalStr.indexOf('*6*'+disposal.disposalContent)>=0) {
										vm.check6List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
									}else if (disposalStr.indexOf('*7*'+disposal.disposalContent)>=0) {
										vm.check7List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
									}else if (disposalStr.indexOf('*8*'+disposal.disposalContent)>=0) {
										vm.check8List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
									}
								});
								//添加开药或者编辑的
								disposalStr.split('###').forEach(function(disposal){
									if (disposal.indexOf('@')==0) {
										var type = 'type'+disposal.split('@')[1];
										if (type=='type1') {
											vm.edit1List.push({
												disposalContent:disposal,
												disposalAdvice:disposal.split('@')[2]
											});
										}else if (type=='type2') {
											vm.edit2List.push({
												disposalContent:disposal,
												disposalAdvice:disposal.split('@')[2]
											});
										}else if (type=='type3') {
											vm.edit3List.push({
												disposalContent:disposal,
												disposalAdvice:disposal.split('@')[2]
											});
										}else if (type=='type4') {
											vm.edit4List.push({
												disposalContent:disposal,
												disposalAdvice:disposal.split('@')[2]
											});
										}else if (type=='type5') {
											vm.edit5List.push({
												disposalContent:disposal,
												disposalAdvice:disposal.split('@')[2]
											});
										}else if (type=='type6') {
											vm.edit6List.push({
												disposalContent:disposal,
												disposalAdvice:disposal.split('@')[2]
											});
										}else if (type=='type7') {
											vm.edit7List.push({
												disposalContent:disposal,
												disposalAdvice:disposal.split('@')[2]
											});
										}else if (type=='type8') {
											vm.edit8List.push({
												disposalContent:disposal,
												disposalAdvice:disposal.split('@')[2]
											});
										}else if (type == 'typedrug') {
											vm.editDrugList.push({
												disposalContent:disposal,
												disposalAdvice:disposal.split('@')[2]
											});
										}else if (type == 'typeexam') {
											vm.editExamList.push({
												disposalContent:disposal,
												disposalAdvice:disposal.split('@')[2]
											});
										}
									}
								});
							}
							if (nurseDisposalStr) {
								vm.checkNurseDisposal=[];
								vm.patient.nurseDisposals.forEach(function(disposal){
									if (nurseDisposalStr.indexOf(disposal.disposalContent+"###")>=0) {
										vm.checkNurseDisposal.push(disposal.disposalContent);
									}
								});
							}
							if (addNurseDisposalStr) {
								vm.addNurseDisposals = [];
								addNurseDisposalStr.split("###").forEach(function(str){
									if (str) {
										vm.addNurseDisposals.push({
											disposalContent:str
										});
									}
								});
							}
							vm.reData.patient.recordUUID ="";
							console.log("回调绑定 over");
						}
					}
					
				},function(res){
					console.log("error:"+res);
				});
			},
			queryNurseDisease:function(queryString, cb){
				var vm =this;
				vm.$axios.queryNurseDiagnosis(queryString,vm.$cookies.get("curUser").hospitalCode).then(function(res){
					if (res.data&&res.data.data) {
						var result = res.data.data;
						result.forEach(function(diagnosis){
						diagnosis.value = diagnosis.diagnosisSymptom;
					});
					cb(result);
					}
					
				},function(res){
					console.log("error:"+res);
				});
			},
			confirmNurse:function(item){
				this.patient.nurseSymptom = item.diagnosisSymptom;
				this.patient.nurseDisease = item.diagnosisName;
				var vm =this;
				if (item.handlePlace) {
					vm.$set(vm.patient,"handlePlace",item.handlePlace);
					vm.$set(vm.patient,"triageTime",vm.commonUtil.dateFormat(new Date(),'yyyy-MM-dd hh:mm:ss'));
				}
			},
			addTreat:function(type){
				if (this.newTreat != '') {
					if (type=='type1') {
						this.edit1List.push({
							disposalContent:'@1@'+this.newTreat,
							disposalAdvice:this.newTreat
						});
					}else if (type=='type2') {
						this.edit2List.push({
							disposalContent:'@2@'+this.newTreat,
							disposalAdvice:this.newTreat
						});
					}else if (type=='type3') {
						this.edit3List.push({
							disposalContent:'@3@'+this.newTreat,
							disposalAdvice:this.newTreat
						});
					}else if (type=='type4') {
						this.edit4List.push({
							disposalContent:'@4@'+this.newTreat,
							disposalAdvice:this.newTreat
						});
					}else if (type=='type5') {
						this.edit5List.push({
							disposalContent:'@5@'+this.newTreat,
							disposalAdvice:this.newTreat
						});
					}else if (type=='type6') {
						this.edit6List.push({
							disposalContent:'@6@'+this.newTreat,
							disposalAdvice:this.newTreat
						});
					}else if (type=='type7') {
						this.edit7List.push({
							disposalContent:'@7@'+this.newTreat,
							disposalAdvice:this.newTreat
						});
					}else if (type=='type8') {
						this.edit8List.push({
							disposalContent:'@8@'+this.newTreat,
							disposalAdvice:this.newTreat
						});
					}
				}
				this.newTreat = '';
			},
			removeTreat:function(index,type){
				if (type=='type1') {
					this.edit1List.splice(index,1);
				}else if (type=='type2') {
					this.edit2List.splice(index,1);
				}else if (type=='type3') {
					this.edit3List.splice(index,1);
				}else if (type=='type4') {
					this.edit4List.splice(index,1);
				}else if (type=='type5') {
					this.edit5List.splice(index,1);
				}else if (type=='type6') {
					this.edit6List.splice(index,1);
				}else if (type=='type7') {
					this.edit7List.splice(index,1);
				}else if (type=='type8') {
					this.edit8List.splice(index,1);
				}else if (type=='typeExam') {
					this.editExamList.splice(index,1);
				}else if (type=='typeDrug') {
					this.editDrugList.splice(index,1);
				}
			},
			addNurseTreat:function(){
				this.addNurseDialog = true;
			},
			confirmAddDisposal:function(){
				var vm = this;
				if (vm.addDisposalName) {
					vm.addNurseDisposals.push({
						disposalContent:vm.addDisposalName
					});
				}
				vm.addDisposalName = "";
				let addDisposal = "@@@";
				vm.addNurseDisposals.forEach(function(disposal){
					addDisposal = addDisposal+disposal.disposalContent+"###";
				});
				vm.patient.checkNurseDisposal = vm.checkNurseDisposal.join("###")+addDisposal;
			},
			removeAddDisposal:function(index){
				let vm = this;
				vm.addNurseDisposals.splice(index,1);
				let addDisposal = "@@@";
				vm.addNurseDisposals.forEach(function(disposal){
					addDisposal = addDisposal+disposal.disposalContent+"###";
				});
				vm.patient.checkNurseDisposal = vm.checkNurseDisposal.join("###")+addDisposal;
			},
			consult:function(flag){
				var vm = this;
				vm.check1List = [];
				vm.check2List = [];
				vm.check3List = [];
				vm.check4List = [];
				vm.check5List = [];
				vm.check6List = [];
				vm.check7List = [];
				vm.check8List = [];
				if (flag=="fz") {
					vm.category1List.forEach(function(disposal){
							if (disposal.isNecessity.indexOf("1")>=0) {
								vm.check1List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
							}
						});
					vm.category2List.forEach(function(disposal){
						if (disposal.isNecessity.indexOf("1")>=0) {
							vm.check2List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
						}
					});
					vm.category3List.forEach(function(disposal){
						if (disposal.isNecessity.indexOf("1")>=0) {
							vm.check3List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
						}
					});
					vm.category4List.forEach(function(disposal){
						if (disposal.isNecessity.indexOf("1")>=0) {
							vm.check4List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
						}
					});
					vm.category5List.forEach(function(disposal){
						if (disposal.isNecessity.indexOf("1")>=0) {
							vm.check5List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
						}
					});
					vm.category6List.forEach(function(disposal){
						if (disposal.isNecessity.indexOf("1")>=0) {
							vm.check6List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
						}
					});
					vm.category7List.forEach(function(disposal){
						if (disposal.isNecessity.indexOf("1")>=0) {
							vm.check7List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
						}
					});
					vm.category8List.forEach(function(disposal){
						if (disposal.isNecessity.indexOf("1")>=0) {
							vm.check8List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
						}
					});
				}else{
					vm.category1List.forEach(function(disposal){
							if (disposal.isNecessity.indexOf("2")>=0) {
								vm.check1List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
							}
						});
					vm.category2List.forEach(function(disposal){
						if (disposal.isNecessity.indexOf("2")>=0) {
							vm.check2List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
						}
					});
					vm.category3List.forEach(function(disposal){
						if (disposal.isNecessity.indexOf("2")>=0) {
							vm.check3List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
						}
					});
					vm.category4List.forEach(function(disposal){
						if (disposal.isNecessity.indexOf("2")>=0) {
							vm.check4List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
						}
					});
					vm.category5List.forEach(function(disposal){
						if (disposal.isNecessity.indexOf("2")>=0) {
							vm.check5List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
						}
					});
					vm.category6List.forEach(function(disposal){
						if (disposal.isNecessity.indexOf("2")>=0) {
							vm.check6List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
						}
					});
					vm.category7List.forEach(function(disposal){
						if (disposal.isNecessity.indexOf("2")>=0) {
							vm.check7List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
						}
					});
					vm.category8List.forEach(function(disposal){
						if (disposal.isNecessity.indexOf("2")>=0) {
							vm.check8List.push(disposal.disposalContent+'@@@'+disposal.disposalAdvice);
						}
					});
				}
			},
			setPatientSymptoms:function(){
				var vm = this;
				var patientSymptoms="";
				vm.checkSymptomList.forEach(function(symptom){
					patientSymptoms = patientSymptoms + symptom.symptomName +"###";
				});
				patientSymptoms = patientSymptoms + "@@@";
				vm.addSymptomList.forEach(function(symptom){
					patientSymptoms = patientSymptoms + symptom.symptomName +"###";
				});
				vm.patient.patientSymptoms = patientSymptoms;
			},
			setDoctorDisease:function(){
				var vm =this;
				var doctorDisease="";
				var content = vm.checkDiseases.join('-');
				vm.diseaseList.forEach(function(disease){
					if (content.indexOf(disease.diseaseCode)>=0&&disease.diseaseType!="N") {
						doctorDisease = doctorDisease + disease.diseaseName +"###";
					}
				});
				doctorDisease = doctorDisease +"@@@";
				//再遍历添加的疾病，等待处理
				vm.addDiseaseList.forEach(function(disease){
					doctorDisease = doctorDisease + disease.diseaseName +"###";
				});
				vm.patient.doctorDisease = doctorDisease;
			},
			setDoctorDisposal:function(){
				var vm = this;
				var doctorDisposal = "";
				var doctorDisposalAdvice = "";
				//取药开检查、1-8大类，1-8新增
				vm.editDrugList.forEach(function(disposal){
					doctorDisposal = doctorDisposal + disposal.disposalContent +"###";
					doctorDisposalAdvice = doctorDisposalAdvice + disposal.disposalContent+"<br/>";
				});
				vm.editExamList.forEach(function(disposal){
					doctorDisposal = doctorDisposal + disposal.disposalContent +"###";
					doctorDisposalAdvice = doctorDisposalAdvice + disposal.disposalContent+"<br/>";
				});

				vm.check1List.forEach(function(disposalContent){
					doctorDisposal = doctorDisposal + "*1*" +disposalContent.split('@@@')[0] +"###";
					if (disposalContent.split('@@@')[1]) {
						doctorDisposalAdvice = doctorDisposalAdvice +disposalContent.split('@@@')[1] +"<br/>";
					}
				});
				vm.edit1List.forEach(function(disposal){
					doctorDisposal = doctorDisposal + disposal.disposalContent +"###";
					doctorDisposalAdvice = doctorDisposalAdvice + disposal.disposalContent.split('@')[2]+"<br/>";
				});

				vm.check2List.forEach(function(disposalContent){
					doctorDisposal = doctorDisposal + "*2*" +disposalContent.split('@@@')[0]  +"###";
					if (disposalContent.split('@@@')[1]) {
						doctorDisposalAdvice = doctorDisposalAdvice +disposalContent.split('@@@')[1] +"<br/>";
					}
				});
				vm.edit2List.forEach(function(disposal){
					doctorDisposal = doctorDisposal + disposal.disposalContent +"###";
					doctorDisposalAdvice = doctorDisposalAdvice + disposal.disposalContent.split('@')[2]+"<br/>";
				});

				vm.check3List.forEach(function(disposalContent){
					doctorDisposal = doctorDisposal + "*3*" +disposalContent.split('@@@')[0]  +"###";
					if (disposalContent.split('@@@')[1]) {
						doctorDisposalAdvice = doctorDisposalAdvice +disposalContent.split('@@@')[1] +"<br/>";
					}
				});
				vm.edit3List.forEach(function(disposal){
					doctorDisposal = doctorDisposal + disposal.disposalContent +"###";
					doctorDisposalAdvice = doctorDisposalAdvice + disposal.disposalContent.split('@')[2]+"<br/>";
				});

				vm.check4List.forEach(function(disposalContent){
					doctorDisposal = doctorDisposal + "*4*" +disposalContent.split('@@@')[0]  +"###";
					if (disposalContent.split('@@@')[1]) {
						doctorDisposalAdvice = doctorDisposalAdvice +disposalContent.split('@@@')[1] +"<br/>";
					}
				});
				vm.edit4List.forEach(function(disposal){
					doctorDisposal = doctorDisposal + disposal.disposalContent +"###";
					doctorDisposalAdvice = doctorDisposalAdvice + disposal.disposalContent.split('@')[2]+"<br/>";
				});

				vm.check5List.forEach(function(disposalContent){
					doctorDisposal = doctorDisposal + "*5*" +disposalContent.split('@@@')[0]  +"###";
					if (disposalContent.split('@@@')[1]) {
						doctorDisposalAdvice = doctorDisposalAdvice +disposalContent.split('@@@')[1] +"<br/>";
					}
				});
				vm.edit5List.forEach(function(disposal){
					doctorDisposal = doctorDisposal + disposal.disposalContent +"###";
					doctorDisposalAdvice = doctorDisposalAdvice + disposal.disposalContent.split('@')[2]+"<br/>";
				});

				vm.check6List.forEach(function(disposalContent){
					doctorDisposal = doctorDisposal + "*6*" +disposalContent.split('@@@')[0]  +"###";
					if (disposalContent.split('@@@')[1]) {
						doctorDisposalAdvice = doctorDisposalAdvice +disposalContent.split('@@@')[1] +"<br/>";
					}
				});
				vm.edit6List.forEach(function(disposal){
					doctorDisposal = doctorDisposal + disposal.disposalContent +"###";
					doctorDisposalAdvice = doctorDisposalAdvice + disposal.disposalContent.split('@')[2]+"<br/>";
				});

				vm.check7List.forEach(function(disposalContent){
					doctorDisposal = doctorDisposal + "*7*" +disposalContent.split('@@@')[0]  +"###";
					if (disposalContent.split('@@@')[1]) {
						doctorDisposalAdvice = doctorDisposalAdvice +disposalContent.split('@@@')[1] +"<br/>";
					}
				});
				vm.edit7List.forEach(function(disposal){
					doctorDisposal = doctorDisposal + disposal.disposalContent +"###";
					doctorDisposalAdvice = doctorDisposalAdvice + disposal.disposalContent.split('@')[2]+"<br/>";
				});

				vm.check8List.forEach(function(disposalContent){
					doctorDisposal = doctorDisposal + "*8*" +disposalContent.split('@@@')[0]  +"###";
					if (disposalContent.split('@@@')[1]) {
						doctorDisposalAdvice = doctorDisposalAdvice +disposalContent.split('@@@')[1] +"<br/>";
					}
				});
				vm.edit8List.forEach(function(disposal){
					doctorDisposal = doctorDisposal + disposal.disposalContent +"###";
					doctorDisposalAdvice = doctorDisposalAdvice + disposal.disposalContent.split('@')[2]+"<br/>";
				});

				vm.patient.doctorDisposal = doctorDisposal;
				vm.patient.doctorDisposalAdvice = doctorDisposalAdvice;
				//console.log("医生诊疗："+vm.patient.doctorDisposal);
			},
			showDoctorCase:function(){
				//显示诊断病历
				this.setPatientNormal();
				var vm = this;
				var stayTime = "";
				if (vm.patient.startTime) {
					var times = Math.ceil(((new Date()).getTime()-(new Date(vm.patient.startTime)).getTime())/60000);
					if (times/1440>=1) {
						stayTime = parseInt(times/1440) + "天";
					}
					if ((times%1440)/60>=1) {
						stayTime = stayTime + parseInt((times%1440)/60) + "小时";
					}
					if (times%60>1) {
						stayTime =stayTime + times%60 + "分钟";
					} 
				}
				vm.patient.stayTime= stayTime;
				if (!this.patient.nodeUUID) {
					this.patient.nodeUUID = this.commonUtil.guid();
					if (this.patient.patientUUID) {
						//更新患者信息的nodeUUID
						vm.$axios.setNodeUUID(vm.patient.patientUUID,vm.patient.nodeUUID).then(function(res){
							vm.generationDoctorCase();
							vm.doctorCaseDialog = true;
						});
					}else{
						vm.generationDoctorCase();
						vm.doctorCaseDialog = true;
					}
				}else{
					//根据nodeUUID调取已有的信息
					vm.$axios.queryDoctorCase(vm.patient.nodeUUID).then(function(res){
						if (res.data&&res.data.data) {
							vm.doctorCaseObj = res.data.data;
						}else{
							vm.generationDoctorCase();
						}
						vm.doctorCaseDialog = true;
					});
				}
				vm.$axios.queryRecipe(vm.patient.nodeUUID).then(function(res){
						if (res.data&&res.data.data&&res.data.data.length>0) {
							vm.recipeObj = JSON.parse(res.data.data[0].content);
						}
					});
			},
			generationDoctorCase:function(){
				var vm = this;
				//系统自动生成
				if (vm.patient.diseaseTime) {
					vm.doctorCaseObj.complaint = vm.patient.complaintName + vm.patient.diseaseTime;
				}else{
					vm.doctorCaseObj.complaint = vm.patient.complaintName;
				}

				if (vm.patient.department=='住家观察') {
					vm.doctorCaseObj.disposal = (vm.patient.doctorDisposalAdvice+'不适随诊').replace(new RegExp('<br/>','gm'),'\r\n');
				}else{
					vm.doctorCaseObj.disposal = vm.patient.doctorDisposalAdvice?vm.patient.doctorDisposalAdvice.replace(new RegExp('<br/>','gm'),'\r\n'):"";
				}
				vm.doctorCaseObj.diagnosis =vm.patient.doctorDisease?vm.patient.doctorDisease.replace(new RegExp('###','gm'),'\r\n').replace('@@@','').replace(new RegExp(';','gm'),'\r\n'):"";
				vm.doctorCaseObj.symptom = vm.patient.patientSymptoms?vm.patient.patientSymptoms.replace(new RegExp("###","gm"),"\r\n").replace("@@@",""):"";
			},
			showNurseCase:function(){
				//显示护理病历
				this.setPatientNormal();
				var vm = this;
				vm.patient.stayTime = 0;
				if (vm.patient.startTime) {
					vm.patient.stayTime= Math.ceil(((new Date()).getTime()-(new Date(vm.patient.startTime)).getTime())/60000);
				}
				vm.nurseCaseDialog = true;
			},
			setPatientNormal:function(){
				var vm =this;
				var lights = vm.light.manualLight+"_"+vm.light.lifeLight+"_"+vm.light.diseaseLight;
				if (vm.light.curLight=="1"||vm.light.curLight=="2") {
					vm.patient.normal = "良好";
				}else if (vm.light.curLight=="3"&&lights.split("3").length==2) {
					vm.patient.normal = "尚可";
				}else if (vm.light.curLight=="3"&&lights.split("3").length>2) {
					vm.patient.normal = "较差";
				}else if (vm.light.curLight=="4"&&lights.split("4").length==2) {
					vm.patient.normal = "差";
				}else if (vm.light.curLight=="4"&&lights.split("4").length>2) {
					vm.patient.normal = "极差";
				}
			},
			AgreeAndPrint:function(){
				// 1.设置要打印的区域 div的className
			    var newstr = document.getElementById("doctorCase").innerHTML;
			    // 2. 复制给body，并执行window.print打印功能
			    document.body.innerHTML = newstr;
			    window.print();
				this.saveFlag.flag = "SAVE";
			},
			printNurse:function(){
				
			},
			editDoctorCase:function(){
				this.editDoctorFlag = true;
				//let doctorCase = this.doctorCaseObj
				this.copyDoctorCaseObj = JSON.parse(JSON.stringify(this.doctorCaseObj));
			},
			cancleEditDoctorCase:function(){
				this.editDoctorFlag = false;
				this.doctorCaseObj = this.copyDoctorCaseObj;
			},
			confirmEditDoctor:function(){
				let vm = this;
				let doctorCase ={
					"nodeUUID": vm.patient.nodeUUID,
					"complaint": vm.doctorCaseObj.complaint,
					"diagnosis": vm.doctorCaseObj.diagnosis,
					"symptom": vm.doctorCaseObj.symptom,
					"disposal": vm.doctorCaseObj.disposal

				};
				vm.$axios.addDoctorCase(doctorCase).then(function(res){
					vm.editDoctorFlag = false;
				});
			}
		},
		watch:{
			checkSymptoms(curVal,oldVal){
				if (this.reData.patient&&this.reData.patient.recordUUID=="") {
					this.diagnosis();
				}
				var vm =this;
				var checkContent ='-'+ vm.checkSymptoms.join('-') +'-';
				vm.checkSymptomList = [];
				vm.light.symptomLight = "1";
				//获取勾选的对象集合
				vm.symptomList.forEach(function(symptom){
					symptom.isMutex = 0;
					if (checkContent.indexOf('-'+symptom.symptomCode+'-')>=0) {
						vm.checkSymptomList.push(symptom);
						if (symptom.symptomLight) {
							vm.light.symptomLight = vm.light.symptomLight +" "+ symptom.symptomLight;
						}
					}
				});
				//判断勾选的症状是否存在互斥
				var mutexCode1 = "";
				var mutexCode2 = "";
				for (var i = 0; i < vm.checkSymptomList.length; i++) {
					var symptom = vm.checkSymptomList[i];
					var mutexs = symptom.symptomMutex;
					if (!mutexs) {
						continue;
					}else{
						var mutexArray = mutexs.split(",");
						for (var j =0; j< mutexArray.length; j++) {
							if (checkContent.indexOf('-'+mutexArray[j]+'-')>=0) {
								mutexCode1 = symptom.symptomCode;
								mutexCode2 = mutexArray[j];
								break;
							}
						}
					}
					if (mutexCode1&&mutexCode2) {
						this.setMutexStyle(mutexCode1,1);
						this.setMutexStyle(mutexCode2,1);
						break;
					}
				}
				vm.setPatientSymptoms();
			},
			openDialog:{
				handler(curVal,oldVal){
					if (curVal.name == "openExam") {
						this.openExam('typeExam');
					}else if (curVal.name == "openDrug") {
						this.openDrug('typeDrug');
					}
				},
				deep:true
			},
			checkExamList:{
				handler(curVal,oldVal){
					var vm = this;
					if (curVal.length>oldVal.length) {
						vm.examCategoryList.forEach(function(category){
							if (vm.curCategory.examCategoryName == category.examCategoryName) {
								category.examSelected = category.examSelected + 1;
							}
						});
					}else{
						vm.examCategoryList.forEach(function(category){
							if (vm.curCategory.examCategoryName == category.examCategoryName) {
								category.examSelected = category.examSelected - 1;
							}
						});
					}
				}
			},
			checkNurseDisposal:{
				handler(curVal,oldVal){
					let addDisposal = "@@@";
					this.addNurseDisposals.forEach(function(disposal){
						addDisposal = addDisposal+disposal.disposalContent+"###";
					});
					this.patient.checkNurseDisposal = this.checkNurseDisposal.join("###")+addDisposal;
				}
			},
			addSymptomList:{
				handler(curVal,oldVal){
					this.setPatientSymptoms();
				},
				deep:true
			},
			checkDiseases:{
				handler(curVal,oldVal){
					this.setDoctorDisease();
				}
			},
			addDiseaseList:{
				handler(curVal,oldVal){
					this.setDoctorDisease();
				},
				deep:true
			},
			lifeCodes:{
				handler(curVal,oldVal){
					if (this.reData&&this.reData.patient.recordUUID=="") {
						this.diagnosis();
					}
				}
			},
			// light:{
			// 	handler(curVal,oldVal){
			// 		this.diagnosis();
			// 	},
			// 	deep:true
			// },
			editDrugList:{
				handler(curVal,oldVal){
					this.setDoctorDisposal();
				}
			},
			editExamList:{
				handler(curVal,oldVal){
					this.setDoctorDisposal();
				}
			},
			edit1List:{
				handler(curVal,oldVal){
					this.setDoctorDisposal();
				}
			},
			edit2List:{
				handler(curVal,oldVal){
					this.setDoctorDisposal();
				}
			},
			edit3List:{
				handler(curVal,oldVal){
					this.setDoctorDisposal();
				}
			},
			edit4List:{
				handler(curVal,oldVal){
					this.setDoctorDisposal();
				}
			},
			edit5List:{
				handler(curVal,oldVal){
					this.setDoctorDisposal();
				}
			},
			edit6List:{
				handler(curVal,oldVal){
					this.setDoctorDisposal();
				}
			},
			edit7List:{
				handler(curVal,oldVal){
					this.setDoctorDisposal();
				}
			},
			edit8List:{
				handler(curVal,oldVal){
					this.setDoctorDisposal();
				}
			},
			check1List:{
				handler(curVal,oldVal){
					this.setDoctorDisposal();
				}
			},
			check2List:{
				handler(curVal,oldVal){
					this.setDoctorDisposal();
				}
			},
			check3List:{
				handler(curVal,oldVal){
					this.setDoctorDisposal();
				}
			},
			check4List:{
				handler(curVal,oldVal){
					this.setDoctorDisposal();
				}
			},
			check5List:{
				handler(curVal,oldVal){
					this.setDoctorDisposal();
				}
			},
			check6List:{
				handler(curVal,oldVal){
					this.setDoctorDisposal();
				}
			},
			check7List:{
				handler(curVal,oldVal){
					this.setDoctorDisposal();
				}
			},
			check8List:{
				handler(curVal,oldVal){
					this.setDoctorDisposal();
				}
			},
			reData:{
				handler(curVal,oldVal){
					//this.openItem = "item"+this.reData.patient.complaintCode;
					if (curVal.patient.recordUUID) {
						var vm = this;
						vm.openItem = "item"+vm.reData.patient.complaintCode;
						vm.patient.complaintName = vm.reData.patient.complaintName;
						vm.patient.complaintCode = vm.reData.patient.complaintCode;
						vm.symptomList = [];
						vm.checkSymptoms=[];
						vm.addSymptomList = [];
						vm.checkSymptomList=[];
						//清空单独开药开检查内容
						vm.editExamList = [];
						vm.editDrugList = [];
						vm.$axios.querySymptoms(vm.reData.patient.complaintCode).then(function(res){
							var symptomList = [];
							if (res.data&&res.data.data) {
								symptomList = res.data.data;
							}
							symptomList.forEach(function(symptom){
								symptom.isShow = true;
							});
							vm.symptomList = symptomList;
							var systemSymptom = "";
							var userSymptom = "";
							if (vm.reData.patient.recordSymptom.indexOf("@@@")>=0) {
								systemSymptom ="###"+ vm.reData.patient.recordSymptom.split("@@@")[0];
								userSymptom =vm.reData.patient.recordSymptom.split("@@@")[1];
							}
							symptomList.forEach(function(symptom){
								if (systemSymptom.indexOf("###"+symptom.symptomName+"###")>=0) {
									vm.checkSymptoms.push(symptom.symptomCode);
								}
							});
							userSymptom.split("###").forEach(function(symptomName){
								if (symptomName) {
									vm.addSymptomList.push({
									symptomCode:'00',
									symptomName:symptomName
								});
								}
							});
							console.log("症状绑定完毕");
						},function(res){
							console.log("error:"+res);
						}).then(function(){
							vm.diagnosis();
						});
					}
					
				},
				deep:true
			},

		}
	}
</script>
<style type="text/css" scoped>
	.panel{
		margin-top: 10px;
		margin-left: 5px;
		margin-right: 5px;
	}
	.card{
		border: 1px solid #cccccc;
		height: 570px;
		text-align: left;
	}
	.title{
		font-weight: bolder;
		background-color: #eeeeee;
		height: 30px;
		line-height: 30px;
		padding-left: 30px;
	}
	.mainTitle{
		background-color: #F8F8FF;
		color: #000000;
		height: 43px;
		line-height: 35px;
		padding-left: 0px;
	}
	.maitell{
		font-weight: bolder;
		background-color: #eeeeee;
		text-align: center;
		border-top: 1px solid #ffffff;
		height: 30px;
		line-height: 30px;
	}
	.btns{
		text-align: right;
		padding-right: 10px;
		height: 30px;
		line-height: 30px;
		background-color: #eeeeee;
	}
	.content{
		overflow: auto;
		padding-left: 5px;
		height: 537px;
		line-height: 30px;
	}
	.nurseContent{
		overflow: auto;
		padding-left: 5px;
		max-height: 432px;
		line-height: 30px;
	}
	.symptomContent{
		overflow: auto;
		padding-left: 5px;
		height: 495px;
	}
	.symptom{
		line-height: 30px;
		padding-left: 10px;
	}
	.el-menu-item, .el-submenu__title{
		line-height: 45px;
		height: 45px;
	}
	.mutexStyle{
		color: #FFA500;
	}
	.disposalCategory{
		font-weight: bolder;
		color: gray;
		font-size: 9pt;
		cursor: pointer;
	}
	.caseDisposal{
		padding-left: 2.2em;
		line-height: 28px;
		margin-top: 0px;
	}
	#doctorCase label,#nurseCase label{
		font-weight: bolder;
	}
	.smtz{
		color: #000079;
		font-weight: bolder;
		font-size: 10pt;
	}
	.smtz span{
		font-weight: lighter;
		color: #000000;
		font-size: 10pt;
	}
	.line{
		width: 1px;
		height: auto;
		background-color: #000000;
		transform: rotate(15deg);
		/*transform-origin:-30px 0px;*/
		transform-origin:50% 50%;
	}
	.recipeContent{
		padding-left: 35px;
		line-height: 30px;
	}
</style>